﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using Datalayer;
using Entities;
using System.Drawing;

namespace Portal_KonTum.Admin
{
    public partial class Logout : System.Web.UI.UserControl
    {
        string iduser = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["IDName"] == null)
                    Response.Redirect("~/Login.aspx");
                else
                {
                    iduser = Session["IDName"].ToString();
                    try
                    {
                        IQueryMgr iq = QueryMgr.GetDbInstance();
                        User ur = new User();
                        ur = iq.UR_GetUserByID(MethodCommon.Get_Guid(iduser));
                        lblUser.Text = ur.FullName;
                    }
                    catch (Exception ex)
                    {
                        Alert.Show("Lỗi :" + ex.ToString());
                    }
                }
                string logout = Request.QueryString["Logout"];
                if (logout == "true")
                {
                    Session["IDName"] = null;
                    Response.Redirect("~/Login.aspx");
                }
            }
        }
    }
}